﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Ue.Framework.Data;
using Ue.Infrastructure.EntityFactoryFramework;
using Ue.Qcdz.Domain.Permissions;

namespace Ue.Qcdz.Repositories.Permissions
{
    internal class PermissionFactory : IEntityFactory<Permission>
    {
        internal class FieldNames : FieldNamesBase
        {
            public const string Name = "Name";
            public const string FeatureName = "FeatureName";
            public const string Description = "Description";
        }
        #region IEntityFactory
        public Permission BuildEntity(IDataReader reader)
        {

            return new Permission(
                reader.Get<string>(FieldNames.Name),
                reader.Get<string>(FieldNames.FeatureName),
                reader.Get<string>(FieldNames.Description),
                 reader.Get<Guid>(FieldNames.EntityKey)
                );
        }
        #endregion
    }
}
